// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import Vuex from 'vuex'
import ElementUI from 'element-ui'
import axios from 'axios'
import 'element-ui/lib/theme-default/index.css'
import moment from 'moment'
import 'font-awesome/css/font-awesome.css'

Vue.use(Vuex)
Vue.use(ElementUI)
Vue.use(axios)
Vue.use(moment)
Vue.prototype.BASE_URL = '/api'

Vue.config.productionTip = false

let store = new Vuex.Store({})
store.registerModule('eui', {
  state: {
    isLogin: false,
    username: ''
  },
  mutations: {
    updateLoginStatus (state, payload) {
      state.isLogin = payload.isLogin
    },
    updateUsername (state, payload) {
      state.username = payload.username
    }
  }
})

new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: {App}
})
